home *** CD-ROM | disk | FTP | other *** search
- Documentation to FLAT-model
- ───────────────────────────────
-
- We all know that the Rral-mode of the Intel'80xxx serious only allows a
- memory-allocation of max. 1Mbyte.
- If we want to use more memory we had to switch into the Protected-mode.
- In that mode we are able to use the whole installed memory of the PC, but well
- the Protected-mode is organized in a totally other way as the Real-mode, also
- the CPU waste 10% more of the time to organize that Protected-mode compared
- to the Real-mode.
- Well, some time ago some fine hackers find a way to use the whole memory also
- in the Real-mode. The trick is very simple, just swith into the Protected-mode
- turn all segment-register to a limit of 4Gbyte and switch back to the Real-
- mode without resetting the processor and well, we can know reach the whole
- memory from the Real-mode.
-
- In FLAT.INC i followed that way and included some routines to work with this
- model.
- The thing is easy, i switch into the Protected-mode, there i change the
- segment-register ES,FS,GS to a limit of 4Gbyte and switch back to Real-mode.
-
- Mostly i use the GS-register for getting into the memroy up to 1Mbyte.
- But be careful you've to keep some things in mind.
- You can't set the GS-register to 1Mbyte, you have to do it with the offset.
-
- Example: We want to write a 0 into the 1Mbyte ram-position of the PC.
-
- xor ax,ax ; ax=0
- mov gs,ax ; gs=0
-
- -now the GS-register is pointed to the beginn of the PC-ram, now we've
- to add a 1Mbyte offset to it
-
- mov esi,1024*1024
-
- mov gs:esi,0
-
- -now we've written a 0 at the 1Mbyte ram-position.
-
- If you using a HIMEM-driver you've to add a free block of memory to the
- offset, coz the HIMEM-driver loads programms into the HMA, that's the 1st
- 64Kbyte after the 1Mbyte-ram.
- So we have to change out routine in following way:
-
- xor ax,ax
- mov gs,ax
-
- mov esi,1024*1024+65535
-
- mov gs:esi,0
-
-
- that's it.......
-
- Well, the routine in the FLAT.INC file always have those 1024*1024+65525
- addition included.
- So each time when you read or write to the memory about 1Mbyte over the GS-
- register you alwas have those value added to the offset.
- That means that when you give to the routine the offset 0 it means in real
- 1024*1024+65535.....
-
- Totally simple.......
-
-
-
-